package com.zdo.views;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.views.TagLibrary;

import com.opensymphony.xwork2.util.ValueStack;
import com.zdo.views.freemarker.Models;

/**
 * Tag library. In order make it available to actions,
 * add a new bean to Struts 2 configuration with
 * type {@link TagLibrary}.
 * 
 * Example:
 * 
 * <pre>
 * &lt;bean type=&quot;org.apache.struts2.views.TagLibrary&quot; 
 *     name=&quot;zdo&quot; 
 *     class=&quot;com.zdo.views.TagLibraryImpl&quot; /&gt; 
 * </pre>
 */
public class TagLibraryImpl implements TagLibrary
{
	/**
	 * Gets the FreeMarker models.
	 * 
	 * @param stack value stack.
	 * @param req servlet request.
	 * @param res servlet response.
	 * @return FreeMarker models.
	 */
	public Object getFreemarkerModels (ValueStack stack,
			HttpServletRequest req, HttpServletResponse res)
	{
		return new Models(stack, req, res);
	}

	/**
	 * Gets Velocity directive classes. Velocity is not supported.
	 * 
	 * @return directive classes.
	 */
	@SuppressWarnings("unchecked")
	public List<Class> getVelocityDirectiveClasses ()
	{
		throw new RuntimeException("Velocity is not supported.");
	}
}
